﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Chat_D_LuX_Client.Controls
{
    /// <summary>
    /// Interaction logic for ucChatroom.xaml
    /// </summary>
    public partial class ucChatroom : UserControl
    {
        public ucChatroom()
        {

            InitializeComponent();
            for (int i = 1; i < 11; i++)
            {
                lbRoomUsers.Items.Add(new ucUserFace());
            }
        }

        //variable to send to alternate color property of ucMessage
        private bool _currentColor = false;
        private void btnMessage_Click(object sender, RoutedEventArgs e)
        {   
            //scrape textboxt text and fill message
            ucMessage tempobject = new ucMessage() { MessageText = txtMessage.Text, IsAltColor = _currentColor };
            
            lbChatbox.Items.Add(tempobject);
            if (_currentColor)
            {
                _currentColor = false;
            }
            else 
            {
                _currentColor = true;
            }            
            lbChatbox.ScrollIntoView(tempobject);
            txtMessage.Clear();
            txtMessage.Focus();

            
        }
    }
}
